<?php defined('SYSPATH') or die();?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    {template 'stourtravel/public/public_min_js'}
    {php echo Common::getCss('base.css,order.css,jqtransform.css'); }
    {php echo Common::getScript('jquery.jqtransform.js,hdate/hdate.js');}
    {php echo Common::getCss('hdate.css','js/hdate'); }

    <script language="javascript">

    </script>
</head>

<body style="background-color: #fff">
<div class="derive_box">
    <div class="derive_con">
        <form>
            <table class="derive_tb">
                <tr>
                    <th colspan="1">选择时间：</th>
                    <td>
                        <select name="time_target" id="time_target">
                            <option value="0">申请时间</option>
                            <option value="1">审核时间</option>
                        </select>
                    </td>
                    <td colspan="2">
                        <span class="sel_item">
                            <input type="radio"  name="time" value="1" checked="checked">
                            <label>今日</label>
                        </span>
                        <span  class="sel_item">
                            <input type="radio"  name="time" value="2">
                            <label>昨日</label>
                        </span>
                        <span  class="sel_item">
                            <input type="radio"  name="time" value="3">
                            <label>最近7天</label>
                       </span>
                        <span  class="sel_item">
                            <input type="radio"  name="time" value="5">
                            <label>最近30天</label>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><span><input type="radio"  name="time" value="6" ><label>自定义时间段：</label></span></td>
                    <td  colspan="2">
                        <input type="text" value="" id="starttime" class="time_box" onclick="calendar.show({ id: this })" />
                        <span class="derive_arrow_rig"></span>
                        <input type="text" id="endtime" class="time_box" onclick="calendar.show({ id: this })" />
                    </td>
                </tr>
                <tr>
                    <th colspan="1">筛选条件：</th>
                    <td colspan="3">
                        <span class="select-box w150 mt-5">
                            <select name="isfrozen" class="select">
                                <option value="">会员状态</option>
                                <option {if $params['isfrozen'] == 0 && $params['isfrozen'] != ''}selected{/if} value="0">未冻结</option>
                                <option {if $params['isfrozen'] == 1}selected{/if} value="1">已冻结</option>
                            </select>
                        </span>
                        <span class="select-box w150 mt-5">
                           <select name="status" class="select">
                                <option value="">审核状态</option>
                                <option  {if $params['status'] == -1}selected{/if} value="-1">未申请分销商</option>
                                <option  {if $params['status'] == 0 && $params['status'] != ''}selected{/if} value="0">待审核</option>
                                <option  {if $params['status'] == 1}selected{/if} value="1">已通过</option>
                                <option  {if $params['status'] == 2}selected{/if} value="2">未通过</option>
                            </select>
                        </span>
                        <span class="select-box w150 mt-5">
                            <select name="fxrankid" class="select">
                                <option value="">分销商等级</option>
                                {loop $rank_list $rank}
                                <option  {if $params['fxrankid'] == $rank['id']}selected{/if} value="{$rank['id']}">{$rank['title']}</option>
                                {/loop}
                            </select>
                        </span>
                        <span class="select-box w150 mt-5">
                           <select name="fxgroupid" class="select">
                                <option value="">分销商分组</option>
                                <option {if $params['fxgroupid'] == 0 && $params['fxgroupid'] != ''}selected{/if} value="0">默认分组</option>
                                {loop $group_list $group}
                                <option {if $params['fxgroupid'] == $group['id']}selected{/if} value="{$group['id']}">{$group['title']}</option>
                                {/loop}
                            </select>
                        </span>
                    </td>
                </tr>
            </table>
            <div class="now_derive_box"><a class="derive_btn btn_excel" href="javascript:;">立即导出</a></div>
        </form>
    </div>
</div>
</body>
<script>
    $(function(){
        $(".btn_excel").click(function () {
            var timetype = $("input[name='time']:checked").val();
            var starttime = 0;
            var endtime = 0;
            if (timetype == 6) {
                starttime = $('#starttime').val();
                endtime = $("#endtime").val();
                if (starttime == '' || endtime == '') {
                    ST.Util.showMsg('请选择时间段', 5, 1000);
                    return false;
                }
            }
            var url = SITEURL + 'fenxiao/admin/fenxiao/genexcel/timetype/' + timetype + '?starttime=' + starttime + '&endtime=' + endtime + '&time_target=' + time_target;
            var params = {
                status: $.trim($('select[name="status"]').val()),
                isfrozen: $.trim($('select[name="isfrozen"]').val()),
                fxrankid: $.trim($('select[name="fxrankid"]').val()),
                fxgroupid: $.trim($('select[name="fxgroupid"]').val()),
                timetarget: $.trim($('select[name="time_target"]').val())
            };

            for (var i in params) {
                url += '&' + i + '=' + params[i];
            }
            window.open(url);
       })
    });
</script>
</html>